/********************************************************************/
/*  Copyright (C) SSE-USTC, 2013                                    */
/*                                                                  */
/*  FILE NAME             :  threadpool.c                           */
/*  PRINCIPAL AUTHOR      :  Tangxingyu                             */
/*  SUBSYSTEM NAME        :  test fo Debug                          */
/*  MODULE NAME           :  Debug                                  */
/*  LANGUAGE              :  C                                      */
/*  TARGET ENVIRONMENT    :  Linux                                  */
/*  DATE OF FIRST RELEASE :  2013/6/10                              */
/*  DESCRIPTION           :  write content of reading from shmem    */
/********************************************************************/

/*
 * Revision log:
 *
 * Created by Tangxingyu ,2013/6/10
 *
 */

/*write share mem content for look and debug */
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>

int write_sharemem(char * content,int size,int mailnum)
{
	int vi = 0;
	int high = 0;
	FILE * fp = NULL;
	char filename[20] = ".//00.txt";
	high = mailnum/10;
	filename[3] = mailnum/10+48;
	filename[4] = mailnum%10+48;
	printf("filename is %s\n",filename);
	fp = fopen(filename,"wt");
	assert(fp!=NULL);
	vi = 0;
	while(vi<size)
	{
		fputc(content[vi],fp);
		vi++;
	}
	fclose(fp);
	//printf("free fp OK!\n");
	return vi;
}

/*
int main(void)
{
	char test1[100] ="1234567";
	char test2[100] ="01234567";
	char test3[100] ="hello world\n";
	write_sharemem(test1,strlen(test1),1);
	write_sharemem(test2,strlen(test2),2);
	write_sharemem(test3,strlen(test3),3);
 	return 0;
}
*/
